#!/usr/bin/env bash 

cd $(dirname $0)

awk 'NR==FNR{a[$2]=$1} NR>FNR{print a[$1],$0}' f1.txt f2.txt  